home *** CD-ROM | disk | FTP | other *** search
- /* arexx Script
- Motion Blur
- */
-
- call addlib("rexxmathlib.library", 5, -30, 0)
-
- options results
- parse ARG Port x1 y1 x2 y2 b
-
- ADDRESS COMMAND
-
- Length=40
- Angle=0
- Mix=50
- Dec=1
-
- IF EXISTS('PerfectPaint:Prefs/Rexx_Prefs/MotionBlur') THEN DO
- IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/MotionBlur', "R") then DO
- Length= READLN('lfile')
- Angle= READLN('lfile')
- Mix= READLN('lfile')
- Dec= READLN('lfile')
- CALL CLOSE('lfile')
- END
- END
-
- ADDRESS value Port
-
- pp_GetDepth
- D=result
- IF D<24 then DO
- pp_Warn 'This*script*is*only|for*24bits*Picture.'
- pp_PermitRefresh
- Exit
- END
-
- W=x2-x1+1
- H=y2-y1+1
-
- pp_DialogInit 250 115 "*Motion*Blur*" 4
- pp_Integer 0 140 5 50 16 "Length*(5-60)" 1 Length
- pp_Integer 1 140 25 50 16 "Angle*(0-359)" 1 Angle
- pp_Integer 2 140 45 50 16 "Mix*value*(1-100)" 1 Mix
- pp_Integer 3 140 65 50 16 "Mix*decrement*(0-50)" 1 Dec
- pp_Dialog
- rc=result
- if rc=0 then
- do
- EXIT
- end
-
- pp_GetDialog 0
- Length=result
-
- pp_GetDialog 1
- Angle=result
-
- pp_GetDialog 2
- Mix=result
-
- pp_GetDialog 3
- Dec=result
-
- CALL SavePrefs('MotionBlur',Length,Angle,Mix,Dec)
- ADDRESS value Port
-
- if Angle=90|Angle=270 then Angle=Angle+1
- Rads=Angle*(3.14149/180)
-
- if Length>50 then Mix=Length
-
- pp_StencilStat
- Stencil=result
-
- pp_PicttoSpare
- pp_SpareOnOff
-
- if Stencil=1 then DO
- pp_StencilOff
- END
-
- pp_PickBrush x1 y1 W H
-
- pp_GetWidthB
- IF result=0 THEN DO
- pp_Warn 'Not*enough*memory.'
- EXIT
- END
-
- if Stencil=0 then DO
- pp_UpdateUndo
- END
-
- Do i=Length*2 to 2 by -2
- X=trunc(sqrt(power(i,2)/(1+power(abs(tan(Rads)),2))))
- Y=trunc(sqrt(power(i,2)-power(x,2)))
-
- if Angle>90 & Angle<270 then X=-X
- if Angle>0 & Angle<180 then Y=-Y
-
- pp_BrushOpacity Mix
- pp_Plot x1+X+W/2 y1+Y+H/2
-
- Mix=Mix-Dec
- END
-
- IF Stencil=1 then DO
- pp_StencilOn
- END
-
- pp_FreeBrush
-
- Mix=100-TRUNC((2/5)*Length+6)
- pp_SpareOnOff
- pp_ComposeReqOff
- pp_UpdateUndoBox x1 y1 x2 y2
- pp_EffectOn
- pp_Spare
- pp_Compose 0 Mix 0
- pp_Boxf x1 y1 x2 y2
- pp_EffectOff
- pp_ComposeReqOn
-
- EXIT
-
- SavePrefs: PROCEDURE
-
- Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
-
- if EXISTS(Prefname) THEN DO
- ADDRESS COMMAND
- 'delete >nil: '||Prefname
- END
-
- IF OPEN('pfile',PrefName,'W') THEN DO
-
- do i=2 to ARG()
- CALL WRITELN('pfile',ARG(i))
- end
-
- CALL CLOSE('pfile')
-
- RETURN
-
-